package com.yt.dor.service;

import com.yt.dor.models.vo.DormBuildingVO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import com.yt.dor.common.config.YmlConfig;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yt.dor.mapper.DormBuildingMapper;
import com.yt.dor.models.service.IDormBuildingService;
import com.yt.dor.models.bo.DormBuildingSaveBO;
import com.yt.dor.models.dto.DormBuildingDTO;

import java.util.List;

/**
 * 宿舍楼表控制器
 *
 * @author thekai
 * @Date 2025-10-21 14:12:50
 */
@DubboService
public class DormBuildingServiceImpl extends ServiceImpl<DormBuildingMapper, DormBuildingDTO> implements IDormBuildingService{

    @Resource
    private YmlConfig ymlConfig;
    @Resource
    private DormBuildingMapper dormBuildingMapper;

    @Override
    public boolean add(DormBuildingSaveBO saveBO) {
        DormBuildingDTO dto = new DormBuildingDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }
    @Override
   public List<DormBuildingVO> queryDormBuild(){
        List<DormBuildingVO> dormBuildingVOS = dormBuildingMapper.query();
        return dormBuildingVOS;
    }


}
